#include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;

#define STDIN
//#define DEBUG

int N;

void process() {

    int sum = 0;
    for (int i = 1; i < N && sum <= N; i++) {
        if (N%i == 0) {
            sum += i;
        }
    }
    cout << setw(5) << N << "  ";
    if (sum == N) {
        cout << "PERFECT" << endl;
    } else if (sum < N) {
        cout << "DEFICIENT" << endl;
    } else {
        cout << "ABUNDANT" << endl;
    }
}

int main() {
#if defined(STDIN)
    fstream cin("bin/1528.in");
#endif

    cout << "PERFECTION OUTPUT" << endl;
    while(cin >> N && N != 0) {
#if defined(DEBUG)
        cout << "处理:" << N << endl;
#endif
        process();
    }
    cout << "END OF OUTPUT" << endl;



    return 0;
}
